package net.sinodata.smartframework.component;

import javax.annotation.PreDestroy;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import net.sinodata.smartframework.threadpool.base.QueueThreadPoolManager;

/**
 * Description: 优雅关闭线程池
 * 
 * @author: yinliangyun
 * @date: 2021-5-18
 */
@Component
public class QueueThreadPoolDestroy {
	
	private static final Logger logger = LoggerFactory.getLogger(QueueThreadPoolDestroy.class);
	
	@PreDestroy
    public void destory() throws Exception {
		logger.info("QueueThreadPoolDestroy destory start");
		QueueThreadPoolManager.getInstance().stopAllThreadPools();
		logger.info("QueueThreadPoolDestroy destory success");
    }

}
